package org.easydarwin.easyplayer.zhi;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import org.easydarwin.easyplayer.PlaylistActivity;
import org.easydarwin.easyplayer.R;
import org.easydarwin.http.SpfUtils;


/**
 * Created by ADM on 2017/12/2.
 * 我的信息
 */

public class Me_data_activity extends BaseActivity implements View.OnClickListener, PopupWindow.OnDismissListener {
    private PopupWindow popupWindow;
    private int navigationHeight;
    private TextView Gender;
    private LinearLayout me_Gender, me_Label;

    @Override
    public int setLayoutId() {
        int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
        navigationHeight = getResources().getDimensionPixelSize(resourceId) - 80;
        return R.layout.me_medata;
    }

    @Override
    public void initViewsAndEvents() {
        findID();


    }



    Button button;

    ImageView imageView;
    RelativeLayout xiugai;
    LinearLayout dizhixuanze;
    TextView dizhi,me_title;
    private void findID() {
        String name = (String) SpfUtils.get(this, "user_name", "");
        String sex = (String) SpfUtils.get(this, "sex", "");
        String location = (String) SpfUtils.get(this, "location", "");

        me_Gender = (LinearLayout) findViewById(R.id.me_Gender);//性别

        button = (Button) findViewById(R.id.button);//性别
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SpfUtils.put(Me_data_activity.this, "islogin", false);
                PlaylistActivity.getInstance().finishActivity();
                startActivity(new Intent(Me_data_activity.this, LoginActivity.class));
                finish();
            }
        });

        Gender = (TextView) findViewById(R.id.Gender);//性别
        Gender.setText(sex);
        dizhi = (TextView) findViewById(R.id.dizhi);//性别
        dizhi.setText(location);
        me_title = (TextView) findViewById(R.id.me_title);//性别
        me_Gender.setOnClickListener(this);
        me_Label = (LinearLayout) findViewById(R.id.me_Label);//我的标签

        imageView = (ImageView) findViewById(R.id.touxiang);//我的标签

        xiugai = (RelativeLayout) findViewById(R.id.xiugai);//性别
        dizhixuanze = (LinearLayout) findViewById(R.id.dizhixuanze);//性别
        dizhixuanze.setOnClickListener(this);
        xiugai.setOnClickListener(this);
        me_Label.setOnClickListener(this);
        me_title.setText(name);


    }





    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.me_Gender:

                break;

            case R.id.xiugai:

                break;


            case R.id.dizhixuanze:

                break;




        }


    }



    //设置屏幕背景透明效果
    public void setBackgroundAlpha(float alpha) {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = alpha;
        getWindow().setAttributes(lp);
    }

    @Override
    public void onDismiss() {
        setBackgroundAlpha(1);
    }
}